﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Itop.YHPC.controller;
using Itop.YHPC.Model;

namespace Itop.YHPC.workflow
{
    public partial class workflow_back_ajax : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["id"];
            string text = Request.QueryString["text"];
            yhpcMain main = workflowController.GetMain(id);
            main.lcflag = main.tjflag;
            main.lcstatus = "退回，待处理";
            main.backdate = DateTime.Now;
            main.backer = (Session["user"] as sysuser).UserName;
            main.backflag = "1";
            main.lcrecord = main.lcrecord + "->" + string.Format("{0}于{1}[{2}]-做退回处理，原因：" + text, (Session["user"] as sysuser).UserName, DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss"), GetLCName(main.bhflag));

            workflowController.Update(main);
        }

        public string GetLCName(string lcflag)
        {
            sysprog prog = workflowController.GetProgList(" where id='" + lcflag + "'")[0];
            return prog.ProgName;
        }
    }
}
